home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / pgs3h1.lha / 3.0hUpdate / Macros.LHA / cmdshell.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-12  |  943b  |  56 lines

  1. /* $VER: Command Shell 1.1 (12.06.95) */
  2.  
  3.  
  4. options results
  5. options failat 100
  6.  
  7. open('console', 'CON:0/11/640/100/PageStream3/SCREEN PageStream3', 'RW')
  8. writeln('console', 'Enter commands, "Q" to exit.')
  9.  
  10. address 'PAGESTREAM'
  11.  
  12. /* loop until user exits */
  13. do forever
  14.  
  15.     /* get command string from user */
  16.     writech('console','CMD> ')
  17.     cmd=readln('console')
  18.  
  19.     select
  20.  
  21.         /* time to quit? */
  22.         when (upper(cmd) = "Q") then do
  23.             leave
  24.         end
  25.  
  26.         /* need some help? */
  27.         when (cmd = "?") then do
  28.             writeln('console', 'Enter "Q" to exit.')
  29.         end
  30.  
  31.         /* do nothing on empty lines */
  32.         when (cmd = "") then do
  33.             nop
  34.         end
  35.  
  36.         /* process the line */
  37.         otherwise do
  38.             /* execute the command string */
  39.             cmd
  40.  
  41.             /* if ok show the result, if any */
  42.             if (RC = 0) then do
  43.                 if result ~= "RESULT" then writeln('console', result)
  44.                 if (upper(cmd) = "QUIT") then leave
  45.             end
  46.  
  47.             else do
  48.                 writeln('console', '*** Error');
  49.             end
  50.         end
  51.     end
  52. end
  53.  
  54. exit(0)
  55.  
  56.